package jmetal.util;

import java.io.IOException;

import org.python.core.PyArray;
import org.python.core.PyFunction;
import org.python.util.PythonInterpreter;

import jmetal.core.Solution;
import jmetal.core.SolutionSet;

public class PyPlotUtil {
	public static void plotPopulation(SolutionSet solutionSet){
		int size = solutionSet.size();
		int objDim = solutionSet.get(0).getNumberOfObjectives();
		double[][] matrixSolutionSet = new double[size][objDim];
		for(int i = 0;i<size;i++){
			Solution solution = solutionSet.get(i);
			for(int j = 0;j<objDim;j++){
				matrixSolutionSet[i][j] = solution.getObjective(j);
			}
		}
		PythonInterpreter interpreter = new PythonInterpreter();
		interpreter.execfile("plot.py");
		PyFunction function = interpreter.get("plot_fig",PyFunction.class);
		
//		function.__call__(new PyArray());
		
	}
	public static void main(String[] args) throws IOException {
		Runtime.getRuntime().exec("Hello.py");
		
	}
}
